import { request } from "@/utils/http";
import React from "react";
import type { ReqHospitalSetListParams,ReqHospitalSetListResponse,ReqAddHospitalParams, HospitalSetList, HospitalSetItem, ReqUpdateHospitalParams } from "./model/hospitalSetTypes";

export function reqGetHospitalSetList({page,limit,hoscode,hosname}:ReqHospitalSetListParams){
        return request.get<any,ReqHospitalSetListResponse>(`/admin/hosp/hospitalSet/${page}/${limit}`,{
            params:{
                hosname:hosname,
                hoscode:hoscode
            }
        })
}

// 新增医院请求
export function reqAddHospital(hospitalSet:ReqAddHospitalParams){
    return request.post<any,null>("/admin/hosp/hospitalSet/save",hospitalSet)
}

// 查看单个医院信息
export function reqGetHospital(id:string){
    return request.get<any,HospitalSetItem>(`/admin/hosp/hospitalSet/get/${id}`)
}

// 修改医院信息
export function reqUpdateHospital(hospital:ReqUpdateHospitalParams){
    return request.put<any,null>("/admin/hosp/hospitalSet/update",hospital)
}

// 删除单个医院请求
export function reqRemoveHospital(id:number){
    return request.delete<any,null>(`/admin/hosp/hospitalSet/remove/${id}`)
}

// 批量删除医院
export function reqBatchRemoveHospitalList(hospital:React.Key[]){
    return request.delete<any,null>(`/admin/hosp/hospitalSet/batchRemove`,{
        data:hospital
    })
}